gdkdevice: use g_set_object to set the associated device
authorIgnacio Casal Quinteiro <qignacio@amazon.com>
Thu, 7 Jan 2021 15:13:39 +0000 (16:13 +0100)
committerIgnacio Casal Quinteiro <qignacio@amazon.com>
Thu, 7 Jan 2021 15:13:39 +0000 (16:13 +0100)
gdk/gdkdevice.c

index 34506fcd37758a857ad69bf6b4219c2db70c8851..f96dbc5e65c3158052d48e8834dbec2ae89034bd 100644 (file)
@@ -611,17 +611,7 @@ _gdk_device_set_associated_device (GdkDevice *device,
   g_return_if_fail (GDK_IS_DEVICE (device));
   g_return_if_fail (associated == NULL || GDK_IS_DEVICE (associated));
 
-  if (device->associated == associated)
-    return;
-
-  if (device->associated)
-    {
-      g_object_unref (device->associated);
-      device->associated = NULL;
-    }
-
-  if (associated)
-    device->associated = g_object_ref (associated);
+  g_set_object (&device->associated, associated);
 }
 
 /*